<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('membership_products', function (Blueprint $table) {
            $table->id();
            $table->string('name', 50)->comment('会员产品名称');
            $table->string('type', 20)->comment('会员类型：month, year, permanent');
            $table->integer('duration')->nullable()->comment('时长（天数），永久卡为null');
            $table->decimal('price', 8, 2)->comment('售价');
            $table->decimal('original_price', 8, 2)->comment('原价');
            $table->string('icon', 10)->nullable()->comment('图标');
            $table->string('purchase_url')->comment('购买链接');
            $table->boolean('is_featured')->default(false)->comment('是否推荐');
            $table->string('badge', 20)->nullable()->comment('角标文字');
            $table->integer('sort_order')->default(0)->comment('排序');
            $table->boolean('is_active')->default(true)->comment('是否启用');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('membership_products');
    }
};